package com.itheima.book.controller.v1;

import com.itheima.book.service.BookService;
import com.itheima.model.book.dtos.BookDto;
import com.itheima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/book")
@Api(value = "图书相关的接口",tags = "图书相关的接口")
public class BookController {
    @Autowired
    private BookService bookService;

    /**
     * 根据分类Id获取图书列表
     * @return
     */
    @PostMapping("/list")
    @ApiOperation("根据分类Id获取图书列表")
    public ResponseResult getBookList(@RequestBody BookDto dto) {
        return bookService.getBookList(dto);
    }

    /**
     * 获取用户的图书笔记列表
     * @param dto
     * @return
     */
    @PostMapping("/note")
    @ApiOperation("获取用户的图书笔记列表")
    public ResponseResult getUserBookNotes(@RequestBody BookDto dto) {
        return bookService.getUserBookNotes(dto);
    }
    /**
     * 获取用户的图书书评列表
     * @param dto
     * @return
     */
    @PostMapping("/review")
    @ApiOperation("获取用户的图书书评列表")
    public ResponseResult getUserBookReviews(@RequestBody BookDto dto) {
        return bookService.getUserBookReviews(dto);
    }

}
